import VueRouter from 'vue-router'

// 导入对应的路由组件
import HomeContainer from './components/tabbae/HomeContainer.vue'
import MemberContainer from './components/tabbae/MemberContainer.vue'
import ShopcarContainer from './components/tabbae/ShopcarContainer.vue'
import SearchContainer from './components/tabbae/SearchContainer.vue'
import Newsliat from './components/news/newslist.vue'
import NewsInfo from './components/news/newsinfo.vue'
import PhotoList from './components/photos/photoList.vue'
import PhotoInfo from './components/photos/photoinfo.vue'
import GoodsList from './components/goods/GoodsList.vue'
import GoodsInfo from './components/goods/GoodsInfo.vue'
import GoodsDesc from './components/goods/GoodsDesc.vue'
import GoodsComment from './components/goods/GoodsComment.vue'

// 创建路由对象photoinfo.vue
let router = new VueRouter({
    routes: [  // 匹配路由规则
        {path: '/', redirect: '/home'},  // 路由重定向，配置根路由
        {path: '/home', component: HomeContainer},  // 首页
        {path: '/member', component: MemberContainer},  // 会员页面
        {path: '/shopcar', component: ShopcarContainer}, // 购物车页面
        {path: '/search', component: SearchContainer},  // 搜索页面
        {path: '/home/newslist', component: Newsliat},  // 新闻列表页面
        {path: '/home/newsinfo/:id', component: NewsInfo},  // 新闻详情页面
        {path: '/home/photoList', component: PhotoList},  // 图片列表页面
        {path: '/home/photoinfo/:id', component: PhotoInfo},  // 图片详情页面
        {path: '/home/goodslist', component: GoodsList},  // 商品列表页面
        {path: '/home/goodsinfo/:id', component: GoodsInfo},  // 商品详情页面
        {path: '/home/goodsdesc/:id', component: GoodsDesc, name: 'goodsdesc'},
        {path: '/home/goodscomment/:id', component: GoodsComment,name:'goodscomment'},
    ],
    linkActiveClass: 'mui-active'  // 覆盖默认的路由高亮的类，默认的类叫做 router-link-active
});

// 把路由对象暴露出去
export default router